package wkt.student;

import lombok.Data;
import wkt.basic.Basic;
import wkt.basic.BasicExamDate;

import java.time.Duration;
import java.util.List;

@Data
public class Student {
    public static final long DAY_SECONDS = Duration.ofDays(1).getSeconds();
    public static final long HOUR_SECONDS = Duration.ofHours(1).getSeconds();
    public static final long MINUTES_SECONDS = Duration.ofMinutes(1).getSeconds();
    private Long id;
    private String name;
    private String mobile;
    private String state = "NORMAL";
    private String account;
    private String password;
    private Long examDateId;
    private String openId;
    private long usedTimeSecond;
    private boolean removeOnAnswerRight;
    private Basic cenci;
    private Basic zhuanye;
    private List<Basic> kemu;
    private BasicExamDate examDate;

    public String getUsedTime() {
        long init = usedTimeSecond;
        if (init == 0) return "";
        if (init < MINUTES_SECONDS) return "不足1分钟";

        String s = "";
        if (init > DAY_SECONDS) {
            s += init / DAY_SECONDS + "天";
            init %= DAY_SECONDS;
        }
        if (init > HOUR_SECONDS) {
            s += init / HOUR_SECONDS + "小时";
            init %= HOUR_SECONDS;
        }
        if (init > MINUTES_SECONDS) {
            s += init / MINUTES_SECONDS + "分钟";
        }
        return s;
    }
}

